<template>
  <el-dialog
    v-el-drag-dialog
    title="安检单批量审核"
    :visible.sync="visible"
    width="400px"
  >
    <el-form style="text-align: center;" label-position="right">
      <el-form-item label="状态">
        <el-select v-model="status" placeholder="请选择">
          <el-option key="ok" label="合格" :value="2" />
          <el-option key="no" label="不合格" :value="3" />
        </el-select>
      </el-form-item>
    </el-form>

    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="examine()">
        审核
      </el-button>
      <el-button @click="visible = false">
        关闭
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import { gasCheckBillAudit } from '@/api/index'
  export default {
    name: 'batchExamine',
    data() {
      return {
        visible: false,
        status: 2,
        OrderArray: []
      }
    },
    methods: {
      open(OrderArray) {
        this.visible = true
        this.OrderArray = OrderArray
      },
      examine() {
        const OrderArray = this.OrderArray
        const checkIdArray = []
        OrderArray.forEach((item, index, row) => {
          checkIdArray.push(item.checkId)
        })
        const checkIds = checkIdArray.join(',')
        gasCheckBillAudit({
          checkIds: checkIds,
          checkStatus: this.status
        }).then(res => {
          if (res.success) {
            this.$message({
              message: '操作成功!',
              type: 'success'
            })
            this.visible = false
            this.$parent.search()
          } else {
            this.$message({
              message: '操作失败！',
              type: 'error'
            })
          }
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
.title {
  margin: 20px 0;
  font-size: 16px;
  font-weight: 700;
}
.gasCheckDetai li {
  margin: 10px;
  p {
    margin: 10px 2rem;
  }
}
.securityOrderImg {
  width: 200px;
  height: 300px;
  margin: 5px 10px;
  border: 1px solid #dfdfdf;
  border-radius: 10px;
}
.securityOrderInfo >>> .el-descriptions__table .el-descriptions-item__cell {
  font-size: 14px;
  line-height: 2.5;
}
.securityOrderInfo >>> .el-descriptions-item__label:not(.is-bordered-label) {
  width: 60px;
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
}
</style>
